
from functools import reduce
def check(str1):
    for i in range(len(str1)-1):
        str1=list(str1)
        flag=str1[i]
        str1[i] =str1[i + 1]
        str1[i + 1]=flag
        str1=''.join(str1)
        if ("AGC" in str1):
            return 1
            break
        str1 = list(str1)
        flag = str1[i]
        str1[i] = str1[i + 1]
        str1[i + 1] = flag
        str1 = ''.join(str1)

    return 0

n=input()
a=['A','C','G','T']
b=['A','G','C']
list1=[]
x=reduce(lambda x, y:[z0 + z1 for z0 in x for z1 in y], [a] * int(n))
y="AGC"
print(len(x))
breakpoint()
count=0
for i in range(len(x)):
    if (y in x[i] or check(x[i])):
        #print(x[i])
        count=count-1



    count=count+1

print(count%(pow(10,9)+7))